package com.ld.control.business.chart.service.impl;

import com.ld.control.business.chart.service.ChartService;
import com.ld.control.business.chart.vo.resp.FoldLineRespVo;
import com.ld.control.business.chart.vo.resp.SeriesData;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Service
public class ChartServiceImpl implements ChartService {
    @Override
    public FoldLineRespVo getHomeFoldLineChart(Integer viewType) {
        FoldLineRespVo foldLineRespVo = new FoldLineRespVo();
        List<SeriesData> seriesDataList = new ArrayList<>();
        SeriesData seriesData1 = new SeriesData();
        seriesData1.setName("氨氮");
        seriesData1.setType("line");
        seriesData1.setStack("Total");
        Integer[] data1 = {120, 132, 101, 134, 90, 230, 210};
        seriesData1.setDataList(Arrays.asList(data1));
        seriesDataList.add(seriesData1);

        SeriesData seriesData2 = new SeriesData();
        seriesData2.setName("总磷");
        seriesData2.setType("line");
        seriesData2.setStack("Total");
        Integer[] data2 = {220, 182, 191, 234, 290, 330, 310};
        seriesData2.setDataList(Arrays.asList(data2));
        seriesDataList.add(seriesData2);

        SeriesData seriesData3 = new SeriesData();
        seriesData3.setName("总氮");
        seriesData3.setType("line");
        seriesData3.setStack("Total");
        Integer[] data3 = {150, 232, 201, 154, 190, 330, 410};
        seriesData3.setDataList(Arrays.asList(data3));
        seriesDataList.add(seriesData3);

        SeriesData seriesData4 = new SeriesData();
        seriesData4.setName("pH");
        seriesData4.setType("line");
        seriesData4.setStack("Total");
        Integer[] data4 = {320, 332, 301, 334, 390, 330, 320};
        seriesData4.setDataList(Arrays.asList(data4));
        seriesDataList.add(seriesData4);

        SeriesData seriesData5 = new SeriesData();
        seriesData5.setName("COD");
        seriesData5.setType("line");
        seriesData5.setStack("Total");
        Integer[] data5 = {820, 932, 901, 934, 1290, 1330, 1320};
        seriesData5.setDataList(Arrays.asList(data5));
        seriesDataList.add(seriesData5);
        foldLineRespVo.setSeriesDataList(seriesDataList);

        foldLineRespVo.setText("样品数据");
        String[] legendDataList = {"氨氮", "总磷", "总氮", "pH", "COD"};
        String[] xAxisDataList = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
        foldLineRespVo.setLegendDataList(Arrays.asList(legendDataList));
        foldLineRespVo.setXAxisDataList(Arrays.asList(xAxisDataList));
        return foldLineRespVo;
    }
}
